package com.cy.sports.service.mpl;

import com.cy.sports.entity.TUser;
import com.cy.sports.service.ITokenService;
import com.cy.sports.utils.JWTUtil;
import org.springframework.stereotype.Service;

/***
 * token 下发
* @Title: TokenService.java 
* @author djl
* @version V1.0
 */
@Service
public class TokenService implements ITokenService{

	public String getToken(TUser user) {
//		Date start = new Date();
//		long currentTime = System.currentTimeMillis() + 60* 60 * 1000;//一小时有效时间
//		Date end = new Date(currentTime);
//		String token = "";
//
//		token = JWT.create().withAudience(String.valueOf(user.getId())).withIssuedAt(start).withExpiresAt(end)
//				.sign(Algorithm.HMAC256(user.getPassword()));
		return JWTUtil.generateToken(String.valueOf(user.getId()));
	}
}

